package com.skyworth.web.order.service;

import com.skyworth.web.order.domain.OrderModel;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Map;

/**
 * Created by lxs on 2016/6/23.
 */
public interface OrderService {
    /**
     * 已确认订单
     */
    int ORDER_CONFIRMED = 0;
    /**
     * wecat端支付订单
     */
    int ORDER_WECHAT_PAYED = 1;
    /**
     * 未确认订单
     */
    int ORDER_UNCONFIRMED = 2;
    /**
     * 购物车信息
     */
    int ORDER_CART = 3;

    /**
     * 扫描服务员端生成的收款码支付
     */
    int ORDER_USER_SCAN_QR_PAYED = 4;

    /**
     * 用户线下付款
     */
    int ORDER_USER_OFFLINE_PAYED = 5;

    /**
     * 服务员拒绝订单
     */
    int ORDER_WAITER_REFUSE = 6;

    /**
     * 取消保存的购物车
     */
    int ORDER_CART_CANCEL = 7;

    /**
     * 添加或者修改一个订单
     * @param orderModel
     * @return
     */
    OrderModel saveOrUpdate(OrderModel orderModel, List<Map<String,Object>> list);

    OrderModel query(long id);

    Page<OrderModel> queryByUserId(String userId,int page,int pagesize);

    Page<OrderModel> queryByStoreId(long storeId,int page,int pagesize);

    OrderModel deleteByUser(long orderId);

    OrderModel deleteByStore(long storeId);

    OrderModel getLastOrder(String userId);

    OrderModel getLastOrder(long storeId,String userId);

    public void updateOrderState(String userId,long tableId);

    public OrderModel getOrderById(long id);

    public void updateOrderCart(long tableId,String userId);

    public void deleteOrderCart(String userId);
    
    
    OrderModel getLastByTableId(long id);

    void removeById(long id);
    
    Map<String,Object> getOrderForUser(long storeId, String userId, int page);

    /**
     * 服务员拒绝订单
     * @param id
     * @return true 成功 false 失败
     */
    void refuseOrder(Long id);

    void acceptOrder(Long id);

    /**
     * 服务员提交订单
     * @param om
     * @param foods
     * @return
     */
    OrderModel waiterCreateOrder(OrderModel om, List<Map<String, Object>> foods);

    /**
     * 服务员端使用
     *
     * 获取正在进行中的订单即 ORDER_CONFIRMED ORDER_UNCONFIRMED 订单
     *
     * @param storeId
     * @return
     */
    List<OrderModel> getOnGoingOrders(Long storeId);
    
    OrderModel removeMenuItem(Long itemId);
}
